package com.jwdf.uda.ui.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.jwdf.uda.event.IndividualEvent;
import com.jwdf.uda.ui.fragment.base.BaseFragment;
import com.jwdf.uda.ui.fragment.user.personal.MobileChangePassFragment;
import com.jwdf.uda.ui.fragment.user.personal.OldPassChangeFragment;
import com.jwdf.uda.utils.EventBusUtil;

/**
 * Created by Administrator on 2016/6/22.
 */
public class UserLoginPassActivity extends AbsTitleBarActivity {
    private final static int CODE_OLD_PASS = 1;
    private final static int CODE_MOBILE = 2;

    public static void start(Context context, int code) {
        Intent intent = new Intent(context, UserLoginPassActivity.class);
        intent.putExtra("code", code);
        context.startActivity(intent);
    }

    @Override
    protected String getTopTitle() {
        return "修改密码";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBusUtil.registerEvent(this);
    }

    @Override
    protected void onDestroy() {
        EventBusUtil.unregisterEvent(this);
        super.onDestroy();
    }

    public void onEvent(IndividualEvent event) {
        finish();
    }

    @Override
    protected BaseFragment onCreateContentFragment() {
        return CODE_OLD_PASS == getIntent().getIntExtra("code", CODE_OLD_PASS) ?
                new OldPassChangeFragment() : new MobileChangePassFragment();
    }
}
